package com.linghang.lhonline.service.Impl;

import com.linghang.lhonline.dataobject.Homework;
import com.linghang.lhonline.repository.HomeworkRepository;
import com.linghang.lhonline.service.HomeworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class HomeworkServiceImpl implements HomeworkService {

    private HomeworkRepository homeworkRepository;

    @Autowired
    public HomeworkServiceImpl(HomeworkRepository homeworkRepository) {
        this.homeworkRepository = homeworkRepository;
    }

    @Override
    public List<Homework> findByMissionId(Integer missionId) {
        return homeworkRepository.findByMissionId(missionId);
    }

    @Override
    public Homework save(Homework homework) {
        return homeworkRepository.save(homework);
    }

    @Override
    public void delete(Homework homework) {
        homeworkRepository.delete(homework);
    }

    @Override
    public List<Homework> findByStudentId(String studentId) {
        return homeworkRepository.findByStudentId(studentId);
    }

    @Override
    public Homework findByHomeworkId(Integer homeworkId) {
        return homeworkRepository.findByHomeworkId(homeworkId);
    }
}
